#pragma once

#include "../../Common/Interfaces/IParameter.h"
#include "../../Common/Parameter/CheckBox.h"
#include "../../Common/Parameter/Slider.h"

class UIParameter
{
public:
	virtual void UpdateValue() = 0;
	virtual IParameter* GetParameter() = 0;
};


class BooleanUIParameter : public UIParameter
{
private:
	k_CheckBoxParameter* parameter;
	bool* value;
public:
	BooleanUIParameter(IDirect3D9BasePlugin& plugin, bool* value, int Id,
		const std::wstring& key, const std::wstring& name, bool defaultValue)
		: value(value)
	{
		parameter = new k_CheckBoxParameter(plugin, Id, key, name, L"No description.", defaultValue);
	}

	virtual void UpdateValue()
	{
		*value = parameter->get_CurrentValue();
	}
	IParameter* GetParameter(){ return parameter; }
};


class IntegerUIParameter : public UIParameter
{
private:
	k_SliderParameter* parameter;
	int* value;

public:
	IntegerUIParameter(IDirect3D9BasePlugin& plugin, int* value, int Id,
		const std::wstring& key, const std::wstring& name, int min, int max, int default)
		: value(value)
	{
		parameter = new k_SliderParameter(plugin, Id, key, name, L"No description.", min, max, default);
	}

	virtual void UpdateValue()
	{
		*value = parameter->get_CurrentValue();
	}
	IParameter* GetParameter(){ return parameter; }
};


class FloatUIParameter : public UIParameter
{
private:
	k_SliderParameter* parameter;
	float* value;
	float conversionFactor;

public:
	FloatUIParameter(IDirect3D9BasePlugin& plugin, float* value, int Id,
		const std::wstring& key, const std::wstring& name, int min, int max, int default, float conversionFactor)
		: value(value), conversionFactor(conversionFactor)
	{
		parameter = new k_SliderParameter(plugin, Id, key, name, L"No description.", min, max, default);
	}

	virtual void UpdateValue()
	{
		*value = parameter->get_CurrentValue() * conversionFactor;
	}
	IParameter* GetParameter(){ return parameter; }
};
